home *** CD-ROM | disk | FTP | other *** search
-
-
-
- pppprrrrooooffffiiiillll((((2222)))) pppprrrrooooffffiiiillll((((2222))))
-
-
-
- NNNNAAAAMMMMEEEE
- pppprrrrooooffffiiiillll ---- eeeexxxxeeeeccccuuuuttttiiiioooonnnn ttttiiiimmmmeeee pppprrrrooooffffiiiilllleeee
-
- CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- iiiinnnntttt pppprrrrooooffffiiiillll ((((uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttt ****bbbbuuuuffffffff,,,, uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttt bbbbuuuuffffssssiiiizzzz,,,,
- uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttt ooooffffffffsssseeeetttt,,,, uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttt ssssccccaaaalllleeee))));;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- pppprrrrooooffffiiiillll provides CPU-use statistics by profiling the amount of CPU time
- expended by a program. pppprrrrooooffffiiiillll generates the statistics by creating an
- execution histogram for a current process. The histogram is defined for
- a specific region of program code to be profiled, and the identified
- region is logically broken up into a set of equal size subdivisions, each
- of which corresponds to a count in the histogram. With each clock tick,
- the current subdivision is identified and its corresponding histogram
- count is incremented. These counts establish a relative measure of how
- much time is being spent in each code subdivision. The resulting
- histogram counts for a profiled region can be used to identify those
- functions that consume a disproportionately high percentage of CPU time.
-
- _b_u_f_f is a buffer of _b_u_f_s_i_z bytes in which the histogram counts are stored
- in an array of uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttt iiiinnnntttt....
-
- _o_f_f_s_e_t, _s_c_a_l_e, and _b_u_f_s_i_z specify the region to be profiled.
-
- _o_f_f_s_e_t is effectively the start address of the region to be profiled.
-
- _s_c_a_l_e, broadly speaking, is a contraction factor that indicates how much
- smaller the histogram buffer is than the region to be profiled. More
- precisely, _s_c_a_l_e is interpreted as an unsigned 16-bit fixed-point
- fraction with the decimal point implied on the left. Its value is the
- reciprocal of the number of instructions in a subdivision, per counter of
- histogram buffer.
-
- Several observations can be made:
-
- - the maximal value of _s_c_a_l_e, 0x10000, gives a 1-1 mapping of pc's
- to 4-byte words in _b_u_f_f. This value makes no sense for the
- default 16-bit (2-byte) counters, since this means 2 bytes of
- wasted space for every 2 bytes of counter.
-
- - the minimum value of _s_c_a_l_e (for which profiling is performed),
- 0x0002 (1/32,768), maps (by convention) the entire region
- starting with _o_f_f_s_e_t to the first counter in _b_u_f_f.
-
- - a _s_c_a_l_e value of 0x8000 specifies a contraction of two, which
- means every 4-byte instruction maps to 2 bytes of counter space.
- For 16-bit counters this means a 1-1 mapping of instructions to
- counters. For 32-bit counters (see sssspppprrrrooooffffiiiillll((((2222))))) this means two
- 4-byte instructions map to each 4-byte counter.
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- pppprrrrooooffffiiiillll((((2222)))) pppprrrrooooffffiiiillll((((2222))))
-
-
-
- The values are used within the kernel as follows: when the process is
- interrupted for a clock tick (once every 10 milliseconds), the value of
- _o_f_f_s_e_t is subtracted from the current value of the program counter (pc),
- and the remainder is multiplied by _s_c_a_l_e to derive a result. That result
- is used as an index into the histogram array to locate the cell to be
- incremented. Therefore, the cell count represents the number of times
- that the process was executing code in the subdivision associated with
- that cell when the process was interrupted.
-
- Since each cell is only 16 bits wide, it is conceivable for it to
- overflow. No indication that this has occurred is given. If an overflow
- is likely, it is recommended that the alternative sssspppprrrrooooffffiiiillll((((2222)))) be used,
- which supports a superset of pppprrrrooooffffiiiillll((((2222)))) functionality and supports using
- optional 32-bit cells.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- sprofil(2), prof(1), times(2), monitor(3X), fork(2), sproc(2).
-
- NNNNOOOOTTTTEEEESSSS
- Profiling is turned off by giving a _s_c_a_l_e of 0 or 1, and is rendered
- ineffective by giving a _b_u_f_s_i_z of 0. Profiling is turned off when an
- eeeexxxxeeeecccc((((2222)))) is executed, but remains on in both child and parent processes
- after a ffffoooorrrrkkkk (2) or sssspppprrrroooocccc((((2222)))).... Profiling is turned off if a _b_u_f_f update
- would cause a memory fault.
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- A 0, indicating success, is always returned.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-